﻿namespace Token.Module.Options;

public class ApplicationShutdownOptions : IDisposable
{
    public IServiceProvider ServiceProvider { get; }
    
    public IDictionary<object, object?> Items { get; }

    public object? this[object key]
    {
        get => Items.TryGetValue(key, out var value) ? value : null;
        set => Items[key] = value;
    }
    
    public ApplicationShutdownOptions(IServiceProvider serviceProvider)
    {
        ServiceProvider = Check.NotNull(serviceProvider, nameof(ServiceProvider));
        Items = new Dictionary<object, object?>();
    }

    public void Dispose()
    {
        Items.Clear();
    }
}